<?php
/**
 * Created by 绵阳人维网络科技有限公司.
 * User: 罗东华
 * Date: 2016/3/13
 * Time: 17:27
 */

/*当前位置*/

function location(&$id=''){

    if(!$id){
        $res=D('Admin','Logic')->act_menu();

    }else{
        $res=M('menu')->where(array('id'=>$id))->field('name,parentid')->find();
    }
    if($res['parentid']!=0){
         location($res['parentid']);
    }

    if($res['parentid']==0){
        echo $res['name'];
    }else{
        echo '<span class="c-gray en">&gt;</span>'.$res['name'];
    }


}
/*将数组写入公用项目的system系统配置*/
function update_system_config(){
    $config=M('Config')->where(array('status'=>1))->field('name,value,extra,type')->select();
    $data=array();
    foreach($config as $v){
        if($v['type'] == 3 || $v['type'] == 5){
            $data[$v['name']]=$v['extra'];
        }elseif($v['type'] == 4){
            $data[$v['name']]=explode(':',$v['extra']);
        }elseif($v['type'] == 6){
            $data[$v['name']]=analysis($v['value']);
        }else{
            $data[$v['name']]=$v['value'];
        }

    }
    unset($config);
    $file=COMMON_PATH.'Conf/system.php';
    $php="<?php \n /*罗东华986004469自动写入配置*/ \n return ".var_export($data,true)." \n ?>";
    if(file_put_contents($file,$php)>0){
        return true;
    }else{
        return false;
    }

}

function urlconfig($catid){
    //$url=U('Home/Index/model',array('catid'=>$v['catid']));

    $url="/rwn/".$catid.'.html';//伪静态地址

    return $url;

}

